(module
  (type (;0;) (func))
  (type (;1;) (func (param f64) (result f64)))
  (type (;2;) (func (param i32)))
  (type (;3;) (func (result i32)))
  (type (;4;) (func (param f64)))
  (type (;5;) (func (result f64)))
  (func $__wasm_init_memory (type 0)
    block  ;; label = @1
      block  ;; label = @2
        block  ;; label = @3
          i32.const 1100
          i32.const 0
          i32.const 1
          i32.atomic.rmw.cmpxchg
          br_table 0 (;@3;) 1 (;@2;) 2 (;@1;)
        end
        i32.const 1024
        i32.const 0
        i32.const 40
        memory.init $.data
        i32.const 1064
        i32.const 0
        i32.const 36
        memory.fill
        i32.const 1100
        i32.const 2
        i32.atomic.store
        i32.const 1100
        i32.const -1
        memory.atomic.notify
        drop
        br 1 (;@1;)
      end
      i32.const 1100
      i32.const 1
      i64.const -1
      memory.atomic.wait32
      drop
    end
    data.drop $.data)
  (func $pid_controller (type 1) (param f64) (result f64)
    (local i32 i32 i32 i32 i32 i32 f64 i32 f64 f64 f64 f64 i32 f64 f64 i32 f64 i32 f64 f64 i32 i32 f64 f64 i32 f64 i32 i32 f64 f64 f64 f64 f64 f64 i32 f64 f64 f64 f64 i32 f64 i32 i32 f64 f64 f64 f64 f64 f64 i32 f64 f64 f64 f64 i32 f64 i32 f64 i32 i32 i32 i32 f64 f64 f64 i32 i32 i32 f64 f64 f64)
    global.get $__stack_pointer
    local.set 1
    i32.const 32
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    f64.store offset=16
    i32.const 0
    local.set 4
    local.get 4
    i32.load offset=1064
    local.set 5
    block  ;; label = @1
      block  ;; label = @2
        local.get 5
        i32.eqz
        br_if 0 (;@2;)
        i32.const 0
        local.set 6
        local.get 6
        f64.load offset=1024
        local.set 7
        local.get 3
        local.get 7
        f64.store offset=24
        br 1 (;@1;)
      end
      i32.const 0
      local.set 8
      local.get 8
      f64.load offset=1032
      local.set 9
      local.get 3
      f64.load offset=16
      local.set 10
      local.get 9
      local.get 10
      f64.sub
      local.set 11
      local.get 3
      local.get 11
      f64.store offset=8
      local.get 3
      f64.load offset=8
      local.set 12
      i32.const 0
      local.set 13
      local.get 13
      f64.load offset=1072
      local.set 14
      local.get 14
      local.get 12
      f64.add
      local.set 15
      i32.const 0
      local.set 16
      local.get 16
      local.get 15
      f64.store offset=1072
      local.get 3
      f64.load offset=8
      local.set 17
      i32.const 0
      local.set 18
      local.get 18
      f64.load offset=1080
      local.set 19
      local.get 17
      local.get 19
      f64.sub
      local.set 20
      i32.const 0
      local.set 21
      local.get 21
      local.get 20
      f64.store offset=1088
      i32.const 0
      local.set 22
      local.get 22
      f64.load offset=1040
      local.set 23
      local.get 3
      f64.load offset=8
      local.set 24
      i32.const 0
      local.set 25
      local.get 25
      f64.load offset=1048
      local.set 26
      i32.const 0
      local.set 27
      local.get 27
      i32.load offset=1096
      local.set 28
      local.get 28
      f64.convert_i32_s
      local.set 29
      f64.const 0x1.f4p+9 (;=1000;)
      local.set 30
      local.get 29
      local.get 30
      f64.div
      local.set 31
      f64.const 0x1.f4p+9 (;=1000;)
      local.set 32
      local.get 31
      local.get 32
      f64.div
      local.set 33
      local.get 26
      local.get 33
      f64.mul
      local.set 34
      i32.const 0
      local.set 35
      local.get 35
      f64.load offset=1072
      local.set 36
      local.get 34
      local.get 36
      f64.mul
      local.set 37
      local.get 23
      local.get 24
      f64.mul
      local.set 38
      local.get 38
      local.get 37
      f64.add
      local.set 39
      i32.const 0
      local.set 40
      local.get 40
      f64.load offset=1056
      local.set 41
      i32.const 0
      local.set 42
      local.get 42
      i32.load offset=1096
      local.set 43
      local.get 43
      f64.convert_i32_s
      local.set 44
      f64.const 0x1.f4p+9 (;=1000;)
      local.set 45
      local.get 44
      local.get 45
      f64.div
      local.set 46
      f64.const 0x1.f4p+9 (;=1000;)
      local.set 47
      local.get 46
      local.get 47
      f64.div
      local.set 48
      local.get 41
      local.get 48
      f64.div
      local.set 49
      i32.const 0
      local.set 50
      local.get 50
      f64.load offset=1088
      local.set 51
      local.get 49
      local.get 51
      f64.mul
      local.set 52
      local.get 52
      local.get 39
      f64.add
      local.set 53
      local.get 3
      local.get 53
      f64.store
      local.get 3
      f64.load offset=8
      local.set 54
      i32.const 0
      local.set 55
      local.get 55
      local.get 54
      f64.store offset=1080
      local.get 3
      f64.load
      local.set 56
      i32.const 0
      local.set 57
      local.get 57
      f64.convert_i32_s
      local.set 58
      local.get 56
      local.get 58
      f64.lt
      local.set 59
      i32.const 1
      local.set 60
      local.get 59
      local.get 60
      i32.and
      local.set 61
      block  ;; label = @2
        block  ;; label = @3
          local.get 61
          i32.eqz
          br_if 0 (;@3;)
          i32.const 0
          local.set 62
          local.get 62
          f64.convert_i32_s
          local.set 63
          local.get 3
          local.get 63
          f64.store
          br 1 (;@2;)
        end
        local.get 3
        f64.load
        local.set 64
        f64.const 0x1.9p+6 (;=100;)
        local.set 65
        local.get 64
        local.get 65
        f64.gt
        local.set 66
        i32.const 1
        local.set 67
        local.get 66
        local.get 67
        i32.and
        local.set 68
        block  ;; label = @3
          local.get 68
          i32.eqz
          br_if 0 (;@3;)
          f64.const 0x1.9p+6 (;=100;)
          local.set 69
          local.get 3
          local.get 69
          f64.store
        end
      end
      local.get 3
      f64.load
      local.set 70
      local.get 3
      local.get 70
      f64.store offset=24
    end
    local.get 3
    f64.load offset=24
    local.set 71
    local.get 71
    return)
  (func $set_sample_period_us (type 2) (param i32)
    (local i32 i32 i32 i32 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    i32.store offset=12
    local.get 3
    i32.load offset=12
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    i32.store offset=1096
    return)
  (func $reset_controller_state (type 0)
    (local i32 f64 i32 i32 f64 i32 i32 f64 i32)
    i32.const 0
    local.set 0
    local.get 0
    f64.convert_i32_s
    local.set 1
    i32.const 0
    local.set 2
    local.get 2
    local.get 1
    f64.store offset=1088
    i32.const 0
    local.set 3
    local.get 3
    f64.convert_i32_s
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    f64.store offset=1072
    i32.const 0
    local.set 6
    local.get 6
    f64.convert_i32_s
    local.set 7
    i32.const 0
    local.set 8
    local.get 8
    local.get 7
    f64.store offset=1080
    return)
  (func $set_open_loop (type 2) (param i32)
    (local i32 i32 i32 i32 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    i32.store offset=12
    local.get 3
    i32.load offset=12
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    i32.store offset=1064
    return)
  (func $get_open_loop (type 3) (result i32)
    (local i32 i32)
    i32.const 0
    local.set 0
    local.get 0
    i32.load offset=1064
    local.set 1
    local.get 1
    return)
  (func $set_open_loop_duty_cycle (type 4) (param f64)
    (local i32 i32 i32 f64 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    f64.store offset=8
    local.get 3
    f64.load offset=8
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    f64.store offset=1024
    return)
  (func $get_open_loop_duty_cycle (type 5) (result f64)
    (local i32 f64)
    i32.const 0
    local.set 0
    local.get 0
    f64.load offset=1024
    local.set 1
    local.get 1
    return)
  (func $set_Kp (type 4) (param f64)
    (local i32 i32 i32 f64 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    f64.store offset=8
    local.get 3
    f64.load offset=8
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    f64.store offset=1040
    return)
  (func $get_Kp (type 5) (result f64)
    (local i32 f64)
    i32.const 0
    local.set 0
    local.get 0
    f64.load offset=1040
    local.set 1
    local.get 1
    return)
  (func $set_Ki (type 4) (param f64)
    (local i32 i32 i32 f64 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    f64.store offset=8
    local.get 3
    f64.load offset=8
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    f64.store offset=1048
    return)
  (func $get_Ki (type 5) (result f64)
    (local i32 f64)
    i32.const 0
    local.set 0
    local.get 0
    f64.load offset=1048
    local.set 1
    local.get 1
    return)
  (func $set_Kd (type 4) (param f64)
    (local i32 i32 i32 f64 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    f64.store offset=8
    local.get 3
    f64.load offset=8
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    local.get 4
    f64.store offset=1056
    return)
  (func $get_Kd (type 5) (result f64)
    (local i32 f64)
    i32.const 0
    local.set 0
    local.get 0
    f64.load offset=1056
    local.set 1
    local.get 1
    return)
  (func $set_target_speed (type 4) (param f64)
    (local i32 i32 i32 f64 i32 f64 i32 i32 i32 i32 f64 i32 f64 f64 i32 i32 i32 f64 i32 f64 i32)
    global.get $__stack_pointer
    local.set 1
    i32.const 16
    local.set 2
    local.get 1
    local.get 2
    i32.sub
    local.set 3
    local.get 3
    local.get 0
    f64.store offset=8
    local.get 3
    f64.load offset=8
    local.set 4
    i32.const 0
    local.set 5
    local.get 5
    f64.convert_i32_s
    local.set 6
    local.get 4
    local.get 6
    f64.lt
    local.set 7
    i32.const 1
    local.set 8
    local.get 7
    local.get 8
    i32.and
    local.set 9
    block  ;; label = @1
      block  ;; label = @2
        local.get 9
        i32.eqz
        br_if 0 (;@2;)
        i32.const 0
        local.set 10
        local.get 10
        f64.convert_i32_s
        local.set 11
        i32.const 0
        local.set 12
        local.get 12
        local.get 11
        f64.store offset=1032
        br 1 (;@1;)
      end
      local.get 3
      f64.load offset=8
      local.set 13
      f64.const 0x1.4p+8 (;=320;)
      local.set 14
      local.get 13
      local.get 14
      f64.gt
      local.set 15
      i32.const 1
      local.set 16
      local.get 15
      local.get 16
      i32.and
      local.set 17
      block  ;; label = @2
        local.get 17
        i32.eqz
        br_if 0 (;@2;)
        f64.const 0x1.4p+8 (;=320;)
        local.set 18
        i32.const 0
        local.set 19
        local.get 19
        local.get 18
        f64.store offset=1032
        br 1 (;@1;)
      end
      local.get 3
      f64.load offset=8
      local.set 20
      i32.const 0
      local.set 21
      local.get 21
      local.get 20
      f64.store offset=1032
    end
    return)
  (func $get_target_speed (type 5) (result f64)
    (local i32 f64)
    i32.const 0
    local.set 0
    local.get 0
    f64.load offset=1032
    local.set 1
    local.get 1
    return)
  (table (;0;) 1 1 funcref)
  (memory (;0;) 2 2 shared)
  (global $__stack_pointer (mut i32) (i32.const 66640))
  (global $__tls_base (mut i32) (i32.const 0))
  (global (;2;) i32 (i32.const 1104))
  (global (;3;) i32 (i32.const 66640))
  (export "memory" (memory 0))
  (export "pid_controller" (func $pid_controller))
  (export "set_sample_period_us" (func $set_sample_period_us))
  (export "reset_controller_state" (func $reset_controller_state))
  (export "set_open_loop" (func $set_open_loop))
  (export "get_open_loop" (func $get_open_loop))
  (export "set_open_loop_duty_cycle" (func $set_open_loop_duty_cycle))
  (export "get_open_loop_duty_cycle" (func $get_open_loop_duty_cycle))
  (export "set_Kp" (func $set_Kp))
  (export "get_Kp" (func $get_Kp))
  (export "set_Ki" (func $set_Ki))
  (export "get_Ki" (func $get_Ki))
  (export "set_Kd" (func $set_Kd))
  (export "get_Kd" (func $get_Kd))
  (export "set_target_speed" (func $set_target_speed))
  (export "get_target_speed" (func $get_target_speed))
  (export "__data_end" (global 2))
  (export "__heap_base" (global 3))
  (start $__wasm_init_memory)
  (data $.data "\00\00\00\00\00\00I@\00\00\00\00\00\80k@\c6\9fQ\f5\8e@\c9?\88vl\f40\12\0d@(\f0\db\d8Y\efe?"))
